<?php
namespace app\common\model;
use think\Model;
class MemberAuth extends Model
{
    // 表名
    protected $name = 'memberauth';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    // 追加属性
    protected $append = [
    ];
    public function memberlogin()
    {
       return $this->hasOne('Member','itemid','memberid');
     }

    public function getAuth($memberid = ''){
        $mauth = $this->get(['memberid'=>$memberid]);
        $arr = explode(',',$mauth['authvalue']);
        $mauth['idcard'] = isset($arr[0])?$arr[0]:'';
        $mauth['idmp'] = isset($arr[1])?$arr[1]:'';
        $mauth['license'] = isset($arr[2])?$arr[2]:'';
        //print_r($mauth);exit;
        return $mauth;
    }
}
?>
